package com.scqkxx.gamebox.activity.myself;

import android.content.ContentValues;
import android.text.TextUtils;
import android.view.View;
import com.jyn.vcview.VerificationCodeView;
import com.scqkxx.gamebox.R;
import com.scqkxx.gamebox.activity.activities.utils.ActivityUtil;
import com.scqkxx.gamebox.activity.activities.view.TitleView;
import com.scqkxx.gamebox.databinding.ActivityMailCodeBinding;
import com.scqkzqtz.base.base.BaseActivity;

public class MailCodeActivity extends BaseActivity<ActivityMailCodeBinding> {

    protected  String code  = "";
    String mEmailUrl = "";

    @Override
    public int setLayoutId() {
        return R.layout.activity_mail_code;
    }

    @Override
    public void init() {
        mEmailUrl = getIntent().getStringExtra("EmailUrl");
        binding.eailUrl.setText("我们向"+mEmailUrl+"发送了           一个验证按,请在下方输入");
        binding.mTitleView.setOnTitleClickListener(mTitleType -> {
            if (mTitleType == TitleView.CLICK_BACK){
                finish();
            }
        });
        binding.verificayionView.setOnCodeFinishListener(new VerificationCodeView.OnCodeFinishListener() {
            @Override
            public void onTextChange(View view, String content) {

            }

            @Override
            public void onComplete(View view, String content) {
                code  = content;
            }
        });
        binding.tvConfirm.setOnClickListener(v -> {
            if (!TextUtils.isEmpty(code) && code.length() >= 4 ){
//                LoginRequestUtils.requestSmsCode(this, LoginRequestUtils.SMSTYPE_FORGET_PASSWORD, code, new OnRequestListener() {
//                    @Override
//                    public void OnVerificationSuccess() { }
//
//                    @Override
//                    public void OnVerificationError(String s) {
//                        ToastUtils.showShortToast(MailCodeActivity.this, s);
//                    }
//
//                    @Override
//                    public void OnSuccer(Map<String, Object> map) {
//
//                    }
//
//                    @Override
//                    public void OnError(String s) {
//                        ToastUtils.showShortToast(MailCodeActivity.this, s);
//                    }
//
//                    @Override
//                    public void onSubscribe(Disposable d) {
//                        addDisposable(d);
//                    }
//                });
                ContentValues contentValues = new ContentValues();
                contentValues.put("code"  , code);
                contentValues.put("EmailUrl"  , mEmailUrl);
                ActivityUtil.switchTo(MailCodeActivity.this,ModifyPasswordActivity.class,contentValues);
            }
        });
    }
}
